<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/Js/My97DatePicker/WdatePicker.js"></script>
<div class="subnav">
  <div class="explain-col" style="position: relative;">
    <form name="searchForm" id="searchForm" method="get" action="__ACTION__">
    	搜索：<input type="text" name="keyword" id="keyword" size="20"  value="<empty name="Think.get.keyword" >请输入搜索关键词<else />{$Think.get.keyword}</empty>" class="input-text" onclick="if(this.value=='请输入搜索关键词')this.value=''"  onblur="if(this.value=='')this.value='请输入搜索关键词'" style="height:20px;" />
      开始时间：<input id="startTime" type="text" class="input-text Wdate" size="30" name="startTime" value="{$Think.get.startTime}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="readonly"  style="width:140px;" />
      结束时间：<input id="endTime" type="text" class="input-text Wdate" size="30" name="endTime" value="{$Think.get.endTime}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="readonly" style="width:140px;" />
      
      <input type="submit" value=" 搜索 " class="button"  />
    </form>
      <div class="content-menu" style="position: absolute; right: 30px;top: 5px;">
        <!--<a href="javascript:openWinBox('__URL__/add','添加备忘录',850,400);" class="add fb"><em>添加备忘录</em></a>-->
      </div>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" action="__URL__/del" method="GET" id="myform">
    <div class="table-list">
    <table width="100%" cellspacing="0">
      <thead>
        <tr>
          <th align="center" width="50" >选择</th>
          <th align="left" width="200" >用户名</th>
          <th align="left" width="200" >登录时间</th>
          <th align="left" >登录IP</th>
        </tr>
      </thead>
      <tbody id="list">
        <volist name="list" id="vo">
          <tr id="list_{$vo.id}">
          	<td align="center"><input name="idArr[]" type="checkbox" value="{$vo.id}"></td>
             <td align="left">{$vo.username}</td>
            <td align="left">{$vo.login_time|date="Y-m-d H:i:s",###}</td>
            <td align="left">{$vo.login_ip}</td>
          </tr>
        </volist>
      </tbody>
    </table>
    
    <div class="btn">
      <div id="pages">{$page}</div>
      <eq name="Think.session.roleId" value="1">
     	 <input name="submit" id="checkall" type="button" class="button" value="全选/反选">
     	 <input name="submit" type="button" class="button" value="删除所选"  onclick="return deleteConfirm();">
      </eq>
    </div>
   
  </form>
</div>
</body>
</html>
<script type="text/javascript">
$(function(){
	$('#myform').ajaxForm({
		beforeSubmit:  checkForm,
		success:       complete,
		dataType: 'json'
	});
	function checkForm(){
		var len = $("input[name='idArr[]']:checked").length;
		if(len < 1){
			msg('先选择删除项！','warning',4);
			return false;
		}
	}
	
	var origin = $.artDialog.open.origin;
	
	function complete(data){
		msg(data.info,data.data);
		if(data.status) setTimeout(function(){origin.location.reload();},1500);
	}
	
	//全反选
	$("#checkall").click(function(){
		$("input[name=idArr[]]").each(function(){
			if(this.checked == false)
				this.checked = true;
			else
				  this.checked = false;
		});
	});

})

function deleteConfirm(){
	art.dialog({
		content: '确定删除所选数据吗？',
		ok: function () {
			del();
			return true;
		},
		cancelVal: '取消',
		cancel: true
	});
}

function del(){
	var idArr = Array();
	var i = 0;
	var id;
	$("input[name='idArr[]']").each(function(){
		if(this.checked == true){
			idArr[i] = $(this).val();
			i++;
		}
	});
	jQuery.post('__URL__/delLoginLog',encodeURI('id='+idArr),success,'json');
	function success(data){
		
		if(data.status==1){
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 2,icon:'succeed'});
		}else{
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 2,icon:'warning'});
		}
		setTimeout(function(){window.location.reload();closeWin(1500);},2000);
	}
}
</script>